package gov.nist.ssd.swqb.core.search;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.RDFNode;

import static gov.nist.ssd.swqb.util.Static.concat;

class LitteralExactSearch extends AbstractAskSearch {
	
  private String litteralContent;
  
	public LitteralExactSearch(ExactMatchText searchText, Model model, int requestsSize) {
	  super(searchText,
	        model,
	        requestsSize,
	        varName("x"),
	        searchPattern(
	            concat(
	              "ASK {",
	              " {?a ?b \"%1$s\".}",
	              " UNION",
	              " {\"%1$s\" ?c ?d.}",
	              "}"
              )
          )
        );
	  
	  litteralContent = searchText.toString();
  }

  @Override
  public RDFNode getNode() {
    return getModel().createLiteral(litteralContent);
  }
}
